<template>
  <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" :visible.sync="visible" class="cu-dialog cu-dialog_center" lock-scroll width="800px">
    <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
      <el-row :gutter="5" type="flex" style="flex-wrap:wrap">
        <el-col :span="18">
          <el-form-item label="报名校区" prop="campusId">
            <el-select v-model="dataForm.campusId" placeholder="请选择" filterable clearable disabled :style="{ width: '100%' }">
              <el-option v-for="(item, index) in campusOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="18">
          <el-form-item label="报名师训" prop="trainId">
            <el-input v-model="dataForm.orderTitle" placeholder="请输入" clearable disabled :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款金额" prop="payAmount">
            <el-input v-model="dataForm.payAmount" placeholder="请输入" clearable disabled :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <!--        <el-col :span="12">
          <el-form-item label="操作人" prop="account">
            <el-input v-model="dataForm.account" placeholder="请输入" clearable :style='{"width":"100%"}'>
            </el-input>
          </el-form-item>
        </el-col>-->
        <el-col :span="12" v-if="dataForm.payAmount > 0">
          <el-form-item label="退款金额" prop="refund">
            <el-input v-model="dataForm.refund" placeholder="请输入退款金额" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="退款类型" prop="type">
            <el-radio-group v-model="dataForm.type">
              <el-radio :label="1" v-if="dataForm.payAmount > 0">退款</el-radio>
              <el-radio :label="2" v-if="dataForm.payAmount > 0">退款退训</el-radio>
              <el-radio :label="3" checked>退训</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="dataForm.type === 1 || dataForm.type === 2">
          <el-form-item label="退款方式" prop="method">
            <el-radio-group v-model="dataForm.method">
              <el-radio :label="1">原路返回</el-radio>
              <el-radio :label="2">线下退款</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="dataForm.type === 2 || dataForm.type === 3">
          <el-form-item label-width="0">
            <span style="color: #ff6a6a;font-size: 12px">*请勾选退训的学员</span>
            <custom-table v-loading="loading" :data="dataForm.teachers" :hasC="true" height="250" @selection-change="handleSelectionChange">
              <el-table-column prop="teacherName" label="参训人" header-align="center" />
              <el-table-column prop="amount" label="师训单价" align="center" />
              <el-table-column prop="statusText" label="状态" align="center" />
            </custom-table>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="退款原因" prop="reason">
            <el-input v-model="dataForm.reason" placeholder="请输入退款原因" show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button :loading="loading" type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export { default } from './index.js'
</script>
